package com.mybatis.test;

import com.mybatis.simple.mapper.TbOrderMapper;
import com.mybatis.simple.pojo.TbOrder;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;

/**
 * @Author 咕唧
 * @Date 2022/5/17 12:24
 * @Version 1.0
 */
public class DemoTest2 {
    @Test
    public void Test5() throws IOException {
        InputStream inputStream = Resources.getResourceAsStream("mybatis-config.xml");
        SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession sqlSession = sessionFactory.openSession();

        TbOrderMapper orderMapper = sqlSession.getMapper(TbOrderMapper.class);
        TbOrder tbOrder = orderMapper.findWithOrderById("20220513224545757ad4b");
        System.err.println(tbOrder);
        sqlSession.close();
    }
}
